package com.example.listener;

import com.example.model.EventMessage;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author yinxin
 * @version 1.0
 * @Description:
 * @date 2022/6/1014:49
 */
@Component
@Slf4j
//@RabbitListener(queues = "short_link.add.link.queue")
@RabbitListener(queuesToDeclare = {@Queue("short_link.error.queue")})
public class ShortLinkErrorMqListener {

    @RabbitHandler
    public void  shortLinkHandle(EventMessage eventMessage, Message message, Channel channel){
        //后续会发送短信到手机上或者写入数据库记录
        log.error("告警 监听到 ShortLinkErrorMqListener eventMessage消息内容{}",eventMessage);
        log.error("告警 Message消息内容{}",message);
        log.error("告警成功,发送通知短信");
    }
}
